import React, {Component} from 'react';
import {Table} from 'antd';

import './index.module.less';


export default class UserTable extends Component {

    constructor(props) {
        super(props);
    }

    componentDidMount() {

    }

    render() {
        const columns = [{
            title: 'ID',
            dataIndex: 'id',
            key: 'id',
        }, {
            title: 'Account',
            dataIndex: 'account',
            key: 'account',
        }, {
            title: 'Name',
            dataIndex: 'name',
            key: 'name',
        }, {
            title: 'Mobile',
            dataIndex: 'mobile',
            key: 'mobile',
        }, {
            title: 'Email',
            dataIndex: 'email',
            key: 'email',
        }];

        const{data, pagination, loading, handleSearch} = this.props;

        const paginationProps = {
            showSizeChanger: true,
            showQuickJumper: true,
            onChange: handleSearch,
            onShowSizeChange: handleSearch,
            ...pagination
        };

        return (
            <div>
                <Table
                    loading={loading}
                    rowKey={record => record.id}
                    columns={columns}
                    dataSource={data}
                    pagination={paginationProps}
                />
            </div>
        );
    }
};


